package com.qys.livesMall.product.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;

import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;

/**
 * <p>
 * H2ShopSkuAttribute对象
 * </p>
 *
 * @author gmx
 * @since 2023-05-17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("h2_product_sku_attribute")
public class H2ProductSkuAttribute implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id",type= IdType.ASSIGN_ID)
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;
    @TableField("spu_id")
    private Long spuId;
    /**
     * 属性名字,不能为空
     */
    @TableField("name")
    @NotNull(message = "属性名字不能为空")
    private String name;
    /**
     * 属性选择,不能为空
     */
//    @TableField(value = "options",typeHandler =StringArrayTypeHandler.class)
//    @NotNull(message = "属性选项不能为空")
//    private String[] options;
    @TableField(exist = false)
    @NotNull(message = "属性选项不能为空")
    private List<ProductSkuAttributeOptions> options;
    /**
     * 排序,不能为空
     */
    @TableField("sort")
    @NotNull(message = "排序不能为空")
    private Integer sort;
    /**
     * 是否启用：0启用，1不启用
     */
    @TableField("enable")
    private Integer enable;
    /**
     * 创建时间
     */
    @JsonIgnore
    @TableField("create_time")
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    @JsonIgnore
    @TableField("update_time")
    private LocalDateTime updateTime;
    /**
     * 创建人
     */
    @TableField("create_by")
    private String createBy;
    /**
     * 更新人
     */
    @TableField("update_by")
    private String updateBy;

}
